<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
	<title>Search Residences</title>
</h:head>
<h:body>
<p:panel>
	<h:link outcome = "bookings" value = "Return To The Package!"/>
</p:panel>
	<h:form id="form1">          
	
     	<p:dataTable  var="residence" value="#{residenceSearch.resUser}"  
     			 
     			
                filteredValue="#{residenceSearch.filteredUser}" 
                id="residencesTable"
                emptyMessage="There are NO Residences"
                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="5,10,15"
				paginator="true"
				cellSeparator="true"
				resizableColumns="true">  

  
        <p:column headerText="Name" sortBy="residenceName" filterBy="residenceName" id="residenceName">  
            #{residence.residenceName}  
        </p:column>   

        <p:column headerText="City" sortBy="city" filterBy="city" id="city">  
            #{residence.city}
        </p:column> 
            
        <p:column headerText="Country" sortBy="country" filterBy="country" id="country">  
            #{residence.country}
        </p:column>    

        <p:column headerText="From" sortBy="fromDate" filterBy="fromDate" id="fromDate">  
            #{residence.fromDate}
        </p:column> 
        
        <p:column headerText="To" sortBy="toDate" filterBy="toDate" id="toDate">  
            #{residence.toDate}
        </p:column>  
        
        <p:column headerText="Price" sortBy="price" filterBy="price" id="price" >  
            #{residence.price}
        </p:column> 
        
        <p:column headerText="Stars" sortBy="stars" filterBy="stars" id="stars">  
            #{residence.stars}
        </p:column>  
        
   		<p:column style="width:32px">  
             <p:commandButton id="det"  update=":dlgForm1:resDetGrid" oncomplete="resDialog.show()"  
                     image="ui-icon ui-icon-search" style="width:32px">  
              
                 <f:setPropertyActionListener value="#{residence}"  
                     target="#{residenceSearch.currentResidence}" />  
             </p:commandButton>  
             
         </p:column>
         <p:column style="width:32px">
                      <p:commandButton style="width:32px"  icon="ui-icon-disk"
       		        		 action="#{residenceSearch.changeResidence()}"  ajax="false" update=":form1:residencesTable">
                     <f:setPropertyActionListener value="#{residence}"  
                     target="#{residenceSearch.currentResidence}" />  
                     </p:commandButton>
         </p:column> 
         
      
   </p:dataTable>
 
</h:form>
    
   
    <p:dialog id="resDialog" header="Details" widgetVar="resDialog" resizable="true"  
              width="600" height="340"  showEffect="exlpode" hideEffect="explode" closeOnEscape="true">  
         <h:form id="dlgForm1">
         <h:panelGrid id="resDetGrid" columns="2" >  
   
					<h:outputLabel>Available*:</h:outputLabel>
				<p:selectBooleanCheckbox value="#{residenceSearch.currentResidence.available}" disabled="true" />
			
				<h:outputLabel>Disponibility*:</h:outputLabel>
				<h:outputText value="#{residenceSearch.currentResidence.disponibility}" />
	            
	
				<h:outputLabel>Price*:</h:outputLabel>
				<h:outputText value="#{residenceSearch.currentResidence.price}" />
			
				
			
				<h:outputLabel>Residence Type*:</h:outputLabel>
				<h:outputText value="#{residenceSearch.currentResidence.type}" />  
				
				
				
				<h:outputLabel>Name*:</h:outputLabel>
				<h:outputText value="#{residenceSearch.currentResidence.residenceName}" /> 
				
				<h:outputLabel>City*:</h:outputLabel>
				<h:outputText value="#{residenceSearch.currentResidence.city}" /> 
				
				<h:outputLabel>Country*:</h:outputLabel>
				<h:outputText value="#{residenceSearch.currentResidence.country}" />
				
	
				<h:outputLabel>Address*:</h:outputLabel>
				<h:outputText value="#{residenceSearch.currentResidence.address}" />
		
				<h:outputLabel>From*:</h:outputLabel>
				<p:calendar value="#{residenceSearch.currentResidence.fromDate}" disabled="true" />
				
		
				<h:outputLabel>To*:</h:outputLabel>
				<p:calendar value="#{residenceSearch.currentResidence.toDate}" disabled="true"/>
				
		
		
				<h:outputLabel >Site:</h:outputLabel>
				<h:outputText value="#{residenceSearch.currentResidence.site}"/> 
		
	
				<h:outputLabel>Phone:</h:outputLabel>
				<h:outputText value="#{residenceSearch.currentResidence.phoneNumber}"/>
		
	
				<h:outputLabel>Rooms*:</h:outputLabel>
				<h:outputText value="#{residenceSearch.currentResidence.rooms}"/> 
		
				<h:outputLabel>Beds*:</h:outputLabel>
				<h:outputText value="#{residenceSearch.currentResidence.rooms}"/>
			
				<h:outputLabel>Stars:</h:outputLabel>
				<p:rating value="#{residenceSearch.currentResidence.stars}" disabled="true"/>  
	  
  		  
        </h:panelGrid>
        </h:form>
        	
    </p:dialog>
    
  </h:body>  	 
  </html>